const express = require('express')
var bodyParser = require('body-parser')

///测试
const app = express()
const port = 3000
app.use(express.static('www'))
///解析body中间件
app.use(bodyParser.json({limit:'100mb'}));

app.all('*', function (req, res, next) {
	res.header("Access-Control-Allow-Origin", "*");///允许的域名
	res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');///允许的请求方式
	res.header("Access-Control-Allow-Headers", "X-Requested-With");///允许的head
	res.header('Access-Control-Allow-Headers', ['mytoken','Content-Type,token']);////允许的head
	next();
});

///wx
const wxRouter = require('./wx')
wxRouter(app)

///admin
const adminRouter = require('./admin')
adminRouter(app)


app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})
